Move javascript into separate, encapsulated files