Fixed bug. Removed unecessary local vars.