added measuring code