Fix docblocks and minor refactoring of __get() method

Copied from ModelAwareTrait