Move screenshot capturing logic into separate module (first step to the new library)