Implemented touch detection to control direction of motion and also added alert dialogs