refactoring and pg_array_parse