added dserov's script part