completed main functionalities