added chain method for composing functinos