Correction of defects

1. Added Lambda-functions
2. Now files are opening with 'with'
3. Enumerate in main algorithm
4. Exceptions are changed to 'except IOError'