fixes table layout and added sorting