Simplify and document util functions.