Python 3 compatibility; clean-up