Breaking out more JS code into JS file.