improved utility functions