added support for arbitrary directories