invalid dictionary refactoring per @electrical and @jordansissel