Move weight calculation into weights package.