Cleaned up JS and refactored index.html