add flag and arrange layout