inside his head melodies would keep rhythm for his feet , and his mind floated free with only the occasional return to reality when his foot struck an unexpected stone or wandered off the edge of the trail .