Extracting external commands into classes