do some refactoring and captured screenshot can be resized