updated to check evironmet variable and adding force option