implement the hot algorithm