better handle edge cases
Assign repeated API call to variable
Merge pull request #19 from deltamualpha/master

Better handle cases where foreach() and in_array() would be called over null arrays