Check return value from index_prepare_for_file
Remove unused variable
Add some prefixes to function names