added if line and simplify package