Code reuse and minor refactoring.