addedd timing measurements...ugly code, needs cleaning