tweaked magnet turning code
fixed merge conflicts