revised to match script