added column to table and cleaned some code