moved calculation to math and returns the result in storage