Merged changes from PyTwat