Abstracted js and added styling