wrote the second function; still need to clean up column names; also, none of this has been tested.