Added function to record midnight data.