Merged version function into one.