moved index scripts into js file