Rename libs to lib
Refactor, add tests