separate control from algorithm