converted to template class and changed pop_head/tail  to pop_front/back