Code used for my PhD work at Stanford