Some code deduplication