Fixed qualified name of env. Implemented unit test for qualified name.
Improved function implementation and added basic unittest for it.