Extract gap buffer implementation into its own class