refactors to improve code quality