Changes the code structure to support various stats libraries.