Added more error checking and a sensitivity option