Formatting fixes

Fixed formatting and changed getNext() to a private member.