pulled out javascript to .js file