added traillink and query string parsing