Tweaked window positioning and added eventhandlers.