updated code to run in sync with robot