Libraries refactor