Small enhancements to the code