integrated directory scanning into controller, improved comments