Refactor so it can be used as a module too
Update README