Added function for simulating tail