finished table refactor