First implementation, use head and tail pointers