Refactored to work as an auto-polling server