Refactore table with buttons