minor refactor: move a utility method, tweaks some other utility methods