Fixed up some code and added spawn and setspawn