Fixes applied to @Gen2ly's version to get arguments to be fed to commands.