Improving code documentation and functionality, and updating the README file