Adjusted script for leave-one-out cross-validation and extended documentation.