Added duplicate query check.
Changed time notation from seconds to ms.