fixed some major bugs. added dates and intervals to database