re-organized js files and added comments