reorganizing code