Add auto play/pause, JS refactoring and UI changes