Move code around where it belongs - created ui.js file