Unified similar code