refactor and add user confirmation and -y