Added main run loop