Removing unnecessary array and just using sum