Changed SQL Queries for Epoch