Support for any size screenshot and minor speed improvements