reorganizing to save memory