winner function now working