added logic update loop