refactored all the structure of Algorithm.
added algorithm property to MainViewController.