Move trails code into it's own module.