Adding script to write index