improvements to code for the article