refactor pecl