re-written whole script