dedupe some common functionality