cleaning some stuff up and reorganizing where data is processed