Add constants for readability.
Minor refactorings.