Converted the dirty code into a function, still need to modify it to show a ranking of other users, not just the closest