refactored flyer writer code into separate file