Add 404 function, clean-up some js file