toType method renamed to as. consistent with other similar methods in the framework