make dir detection a little less sensitive
minor reformatting
move comment