heartbeat module refactored and tested