Adds lexical scoping tests, updates documentation