Implement rest of environment, pass some tests

15 of 54 test cases pass. It's a start.