Moved api class to own file