Final version which works pretty well, IE10 is slacking a bit but I'm giving up