moving all js files to sams.js and cleaning up syntax