Cleaned up api and tests