Started to implement generation of State's. Also modified parameter generation so that out params are properly declared as ref params.