Bug fixes, linted code. disabled W0511 (warn about existing FIXMEs/TODOs)