Updated magnet factory class