Code readability improved with helper functions