code duplication with line 31