Moved measurement code to client