fixed path bugs, added tests and dry-run mode