started reorganizing code