cleanup and ability to redirect command output