fixed typo and prepared the way to get intermediate results