minor optimizations and code consistency updates