Added support for dry run mode and minor bugfixes