code refactor suggestion