worked on flags and conditions