Formatting. Some refactoring.