Formatting and error fixes