refactored code. seperate js files from now on.