type narrowing on some code so as to use instance method directly