Minor formatting and bug fixes