chore(lib): Refactor and split code in modules