Moved calculation of item heights