add an extra window (to see overlapping). Plus minor refactoring