needs better flow control