Moved index javascript to seperate file