Completely rewritten Script.