minor formatting and logic changes