Minor code duplication removed