Rewrite Behavior and write tests