Streamlined code, added support for a list of directories