added ultrasonic distance function and some more bug fixes.