First pass at python3 compatibility