Added new CLI module, related bugfixe and cleanup