Deleted a majority of the duplicate code.