first pass at a refactor; starting with breaking down large methods into smaller