corrected code duplication