code duplication removed