deploy_extra: Refactoring, bug fixing.