Use smart pointer to avoid manual deletion