Merge "Refactor of screenshot code on main thread." into main