implemented helper function