Added automatic height calculation