Use instance variables

Hi @m-1-k-3,

This pull request try to make final mods to https://github.com/rapid7/metasploit-framework/pull/2127, mainly using instance variables as commented there.  I've tried to address by myself.  Hope it has sense for you and I'm not breaking nothing. Feel free to discuss, test, check, etc. and land once ready. If it's not breaking nothing I guess it should be mainly ready to go once it's landed on your side.

Thanks!