Renamed a variable in order to remove double negation; also added some tests