refactor magic view