Added static code analysis
Cleaned up code