Refactor to make some functions unnecessary.