start refactor the heart beat