add ms counter code