cleanup and prep to support Python 3