added delay counter data type and adjusted related functions