Added generic method to scan and invoke groovy