Move screenshot code to a separate action class