[WIP] Authorization system, and refactor some Client code