moving duplicate line out of if statement.