Updated to fix issue with is_null as it doesn't detect empty arrays