Unify spawn code