Tidy up style

Changed the comparison with undefined to a `in` check. Sorta matches the rest of the code better :smiley: