Improves the variable finding algorithm