--Placed all variables inside arrays
--Linked index and main