Only loop 2048 times (HARDCODED) and protect database against bogus periods