Merge duplicated version printing code