implement revBracket in main