All tests pass but code is messy
Cleaned up api code