code resued for index and viral and other function