Utility functions moved into util.hpp.