Move reusable parts into their own file.