Finished implementation of curve discovering.