Update directory search, and improve class structure.