Refactor BDD code