Updated table listener

Made method easier to understand