Fixed misc bugs with formatting