made buffer size configurable

Removed unused imports
Made buffer size configurable