Removing magic numbers. Minor refactoring for readability.