Refactor for gradle build