Added tests from Joey's version, support Class instance reg/resolve