Factored out common code into reusable components.