Move helper function getElementsByClassName to service