Refactor most things for viewer