I may have merged too quickly but why the !in_array() ? It seems useless to me.