separate "shared" class, change some function to singleton object