#97 refactoring HSAlg: finished