Generalized Ransac code to be solver agnostic and minor changes.