Added var declaration for sum