Implemented most of the class