Adapted Mes's timeline code so that it scales with the json file, also less spaghetti