Bascht optimization

CLI optimizations from bascht.
@mcanevet please check these optimizations too