[R2] Create index directory if it doesn't exist
[R2] Remove unused code