refractored / modularized everything