[issue #10] Merged functionality of Container#toSelf() and Container#toClass().