Algorithm kind of working.