updated to bdd and refactored glue code