Fixed stand-alone scripts
Added tests