Moved Algorithms to separate classes