refactored pool to use prototype