Changed overwrite check to second if with break
Testing code