Refactor and adds API v1.