Added some optimizations to project, but crashes on clicking Calculate button
Tried to fix some bugs