Refactored for more compact coding style.