Removed buttons and refactored JS code