defining a method on-the-fly