made some changes to adhere to the sonar rules