Implemented main functionality of the API