Added support for specifying named indexes
Fixed macro