Here's my attempt at doing the same thing. I deleted the lines which are marked in the first post, and also deleted the line with the "AND" above. Seems to work fine in my game so far.

Download