completed layout and calulations