Refactoings and code organization.