Add pool and small refactor