update to libbun2
refactoring code