Refactor parse command; execute while with break