ewmh and miscellaneous code improvements