refactoring, storing best results to localstorage