removed logging, done
better flow control