Repaired Layer Height Calculation Problem

Layer heights were coming back incorrect or negative due to issues with
the previous algorithm.  Layers are now calculated much more reliably.