Move flag-related code into new pkg package

does p come after t in urban dictionary?