added input sanitizing and 404 handler