Made the following changes
1] Changed the algorithm so that even if solve or any other function
raises Error, another heuristic is used
2] Removed duplicated test