Adding general support for 'dim' argument