using filegen's exception
removing unused use
getting count out of for