Completed subsref implementation with unit tests for all reference types.