Ported to gradle build