begun implementing stuff generically
more generic implemenetations. reformat all code. minor refactors.