minor optimizations and stuff