made CommandParser a template class, added Buffer::clear()