Implement file configuration functions

- add read of file count
- simplify code
- remove unnecessary code