added index and main and 104 new lines from lecture