refactored indexdate and added more index period functions