polish and refactoring of command builder