fixed smoothing bug and improved height computation