Naive implementation finished.