new command parsing algorithm