added 404 function, cleaned up some comments