general improvements to utils functions.