layout and logic sorted