added flags and footer