update layout
add state pattern