added measure length function.