Added static code analysis and fixed issues