Software restructuring using hierarchical clustering