Updating and starting to refactor js and html