added 404 handling and fixed indentation