Cleanups and Python tests