Refactor and comments

Refactored the models and wrote comments for all methods in API