WIP: Refactored javascript into files ordered by functionality