added failed status
Added environmnetal variable handle both as option and file