Refactor that separates the main library from the implementation