Added static analysis and fixed some of the issues found