Modified ring buffer to be generic using templates.