Add margin option, create generic XML read/write class