added B\'s code