various logic fixes after code reviews from @eric and @jordansissel