Added :then option to make a callback after the resource is loaded