renamed and reordered functions for easier demonstration