optimizations and fixing bugs