Refactor and clean a bit
API documentation