first implementation of script mode