Disk files a now added to cache + refactoring

Use auto and for loops where possible