Added path recording code