Create functions to handle data, detect type of route