added to_s method, genteral clean up and refactoring