list directory
refactor
separate directory control code
put static where needed