re-organized slightly