Added 404 handling
Added 500 handling