UNTESTED: finished main functionalities