minor changes 

(comments, logging, shortened code)