fixed leaks and use of unitialized variables
collection of same exponent terms