Extracted common methods into library file Tools.cpp along with its header file Tools.h.