moved common method to util