Clean up the chaining of function calls