moved JS from markup to code files.