More work on pythonization. Fixed all discovered regression bugs from last commit.