minor code clean up and added output redirect to scp command