Added support for renaming directories. Improved logging in various places.