Add tests for newly exposed methods
Refactored library code