Modify some code and add comments

Added some comments and modified some lines code for adding data to a
list that contains the filtered data.