Improve utility functions
Improve helper functions.