Convert some untyped variables to typed variables, replace custom Sum function with built-in function (in some locations).
Merge pull request #31 from waqqasdadabhoy/master

Convert some untyped variables to typed variables, replace custom Sum function with built-in function (in some files, to be done for remaining files).