cleaned up behavior and added a test