rearranged example implementation