Preparing to add XML serializer, fixed a few bugs