revising addBehavior method with function behavior