improve syntax to use bags