Simplify everything to functions