Optimize aliases processing

Closes# 2832