Tweak test
Initial work on event loop. Add constants module
pep8 and pyflakes fixes