- Reduced warnings from static code analysis

- Reduced visibility of some variables
- Changed function arguments to const reference when it made sense
- Removed unused private function
- Removed unused variables
- Removed cases were variables were set two times

Signed-off-by: unknown <dgdanielf@gmail.com>