Fix functions for deciding the winner