Various refactors
Add auth middleware
Add auth middleware