Improved the interpreter so that it doesn't add duplicate goals.