added source for the  helper functions