Moved to API, bug fixes