refactored command parser