changing function names to run() and runLoop()