Refactoring, added code analysis