compartmentalized javascript for easy editing. Added basic button functionality