Adding more helper functions to reduce complexity