Added flags code. Should have been incldeded in the previous commit