restructured and added Index()