Uncomment several sections of code
Replace 'length' with 'nrow' when setting index bounds