Improved and cleaned up the JS files