Added a separate function for creating and extending the environment in order to reduce excessive copying
Allowed arbitrary expressions to be in the function position instead of just symbols representing function names