fixed scoping error to allow locally modified variables to take precedence over closure-environment variables (allowing both to co-exist as copies sometimes); added floor and ceil functions, and added array sorting functions to the unit test