refactor shell buffer