Add support for class member variable

supersedes #1417
Oh great and then I can remove the method altogether