improved the class structure