refac code