tweak up_n_down a bit and do a little code cleanup