Updated to fix integer division error