works but with flickering, to be resolved