Added a basic compatibility with the Yggdrasil auth system + lot of
refactoring