update script for functional programming