Altered finalize to return uid