use list concatenation instead of list appending to improve performance