Update commission function, add test.