[MOD] Some optimizations in commandhandling.