Implements tests and  almost complete functionalities