Changing ok function to a method of the api object and some minor bugs
Fix conflict