Just add M3_storage = m[:M3_storage] as a first line of your new function
M3_storage = m[:M3_storage]