Updated method to be compatible with Jtable