Simplified script, cleaning up API.