added code to pick up flags... possibly...