Modified scripts and some error handling