Moved previous win function
Merge branch 'master' into plugins