clean up some uglier functions