Code cleanup

I have continued with cleaning up the source. Basically I have removed some things which are not needed in python 3 any more (classes do not need to inherit from object, utf-8 coding, ...) and I have converted some `file = open()` hacks to a contextmanager. Finally I have refactored `applicationinstance.py` and I tried to find better method names. I am willing to continue contributing if you like my work so far. :)