Added authorization mechanism (first version, still WIP).