reorganized slightly