Removed duplicated condition and unused variable