Removed duplicate function name and completed createTrail() function