layout and calculation issues fixed