made cmds into separate functions. factored out repeated code. fixed upload and resign bugs. Fixed #31