More refactoring and constants extraction.