refactoring
added more stuff
finally! Window gets focus