Consolidated some functions.