simplification and use make_unique