use unique_ptr's for stages