refactering fucntions