Preserve order and integrity of commands

Signed-off-by: Gerco van Heerdt <gercovanheerdt@gmail.com>