Refine commands parsing