Fixes for santized array filtering, removed some unused code