Code used for Aug10 studies