Finished main functionalities