Updated with array math. Removed loop math