Updated to allow for 404 handling and extra security.