Cleaned epoch code