modified class structure, implements singleton pattern