Added additional function argument that will decide whether an empty string will be treated as correct or not.