new_resource function imported from tools.