Refactores passport middleware and actual policies. Fix for #46