Works on Python 2.5
Removed utilities, tidied up code