Buffer fixed. Preliminary ctrl+d support added