Integrate Andy's modifications