Use jdk7 Files api.
Simplify index usage.
Fix index.