Writes tracklist to json file + some minor fixes

tracklist has not yet been checked for duplicates before writing to
file.