added advanced example, added support for dirs