New subrotuine to track the front