Adding Nicholas's code to github.