Fix performance issue

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
Remove duplicate code

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>