Ported to Groovy and kept compatibility to Fuerte.