add clock state logic