cleanup: minor code style improvements
cleanup: more types, use log for output