working for two windows, broken for 3 and more