Refactoring TableHash and Algorithm classes