Cleanup and trying to fix div by zero