Full test coverage and API documentation

WIP