Move script into lib.