Refactor internals to allow limit on # of ops

Will need to rejigger the interface to make this user-configurable.
Default limit of 1000 at the moment.