adding buffer size flag, cleanup