modified c-ext code for maglev