Mostly converted to groovy