clean up constuctor, optimize shrinkBuffer