updated code + pictures for distances