Added more comments to resource-related code