Added head_tail functionality