refactored a bit of code smell.