Separate javascript file, minor cleanup