Some re-arranging to make things simpler