Complete commented code for groovy version