Cleaning up some of the fragment creation code