Remove some duplicate code in commands