Sorting out functions and correcting changed variables.