Sped up a few functions. Added a benchmark for win function, need to speed it up.