Add tests related to error handling.
Filter middleware instead of adding them progressively.
Organize code into certain file structure.