applied DSL to heartbeat algorithm