Changes to better-related algorithm