Calculating height offset properly.