Minimal refactoring for better code.