Dumbed down code to support Python 2.6