use standard way to have nested extensions

since i played around with the code i decided to make a pull request for these changes.
I am not sure if this actually solved the problem you were having in the gradle Forum.