added plot function to IO and modified magic_int