more porting from grails