Lots of changes and added BDD