Made get_dim_size slightly more efficient