Avoid flickering by disable hardware acceleration on webview + some code refactoring