Improve XML serialization by ignoring redundant properties

Also switch to XML attributes where it makes sense to get a cleaner and smaller output