Minor formatting changes and bug fixes