added filtering to repeat command to handle matching braces