Improve helper functions