factor out utility methods.