Abstracted types into middleware.
Added missing semicolons.