starting refactor for core.oauth