added some exception testing to catch errors with the arduino and fail a bit more gracefully, and same for get_IV