refatoring class structure