working out command codes