refactored main.js chaned var "x" = function to function "x"