More concise logic

Since this is already a jQuery plugin, we can use some built-in jQuery functionality to condense the logic down to just three (hopefully still entirely readable) lines.