Convert tool to a library form