reorganized version