code cleanup based on sonar findings, formatting fixes