made some fancy javascript alerts and redirects upon errors