Adding window manager unit tests and bug fixes