WIP implement serializeing and parsing
fixed a few bugs