Updated the preferred entries script to weight hierarchies