Helper functions general enough to be generally useful