Reuse some helper functions.