Further refactoring utility code.