moved height calculation to own private method
added missing docs and tests for autoHeight