Convert api lib to stream logging
Cleaned up some comments