Fixed errors & added comments

Bad references (referring to the parent element of the table instead of
the table itself)