moved duplicated method to utils