can anyone tell me how i can simplify this code i seem to take forever to run and it flickers