fix polling issue by making heartbeat it's own function
Merge pull request #288 from ravolt/heartbeat

fix polling issue by making heartbeat it's own function