increased acceptable timestamp difference threshold; cleaned up some code