changed helper function to an instance method