seperated sapi and auth logic into seperate modules.