a little code redesign