Separated flags from metadata
Added Flag tests