Add a couple of extra utility functions.

These should probably be cleaned up and merged into the existing ones
with morefunctionality rather than having copies.