Fixed a number of issues with zero values and corrected direction gradient
Removed redundant statements added inadvertantly in last change