Lot's more refactoring