Format changes and bug fixes