restructured utility functions