changed to list.append to improve performance