refractored some code after linting