*** Working version with a custom buffer implemented as a list