small optimizations made