removed flag from main function