paper, and slight changes on code