Clean up some unnecessarily duplicated code