Test refectoring to remove redundancy and allow for easier testing.