Helper functions and services