Added support for libraries

Included test cases for coverage