refactor, reduce nesting

not sure if my python is 100% correct, its syntactically correct according to the interpreter, but had an problem withs some dependencies
There's a typo here.  Also, should these be methods on the object.