Add a more flexible system for routines to keep track of their entities