Moved freeValueFunction into it's own cpp file.