Revert "Simplified the code a little to make it more readable."

This reverts commit 695b3b3dab0efda79938ad006b04ff0e4ae89093.