Refactor Presentation Mode code