fixed code duplication