Improved error handling
Returning error codes and created an error page.
Fixed refactoring error where formatDate was removed by mistake