Added try/catch block to capture buffer out of bounds exceptions and display buffer contents