Basic algorithm works.