Handle terminate status from poller. And better logic for engine loop
Merge pull request #155 from mvala/master

Handle terminate status from poller. And better logic for engine loop