Move JS to separate file
minor changes