fixed, added to and reorganised all API methods in main