Refactoring some common authorization callback code. Fixes #3.