Implement Pool and Gate. All tests pass.