tidied and added put index stuff