added renaming functionalitiy to table
rewrote join function