path function returning valid paths