Fixed CLI + added tests