added sum code