This is actually Kristian's code from July 2nd (or earlier), for reference purposes.