moving code around; refactoring