Unify duplicated codes.