General code refactoring.