Split api logic into three separate classes