updated states and layout