implemented ultrasonic sensor, refactored codes