Command manager

Please review/merge.