tail functionality done