Using lists instead of writing to text files