Improving the CLI and some fixes on the lib