Simplify env#namespace and add missing tests
Refactor and add unit test to env.lookup