cleanup
use resource instead of stream
update log