Starting to clean up client-side JS