refactor
track heartbeats
move guts to index.js