Implement nick reclaiming and refactor event loop.