clean up and merge changes from BN