Formatting, and bug fixes