Changed class structure to be more clean