refactored js, added back button hover and active functionality