Refactored Authorization service

Just a little refactorization to the authorization service. More to come...
It looks great - I am going to rewrite it:).