Using all integers works fine, no floats required. But it did not increase the speed of the function at all. Mather fact, the function is actually fast, taking about 10000-15000 ns to complete.
I thought it was lagging but the issue was not in that function. Thanks for all the help anyway!