capture screen refactoring