use indices more effecieintly