faster main loop

main loop re-arranged to get faster screen update