finally. $resource working a bit better