added serializing functions. and stuff.