added code for paper and made some minor documentation changes