Did some static analysis, fixed some bugs and optimized a lot of code