Refactored machines part including cli and added rename functionality to cli