RANSAC implementation