Added optional API time and count tracking