refactored sorts to lib; added word cnt