Consolidated some code.