Internalized all helper functions