Use constants update meta data

Clean up code and write to table so filter definition is shared.