Remove unnecessary code, add heartbeat functionality