Shuffling code around to make it more reusable.