almost got expand func working