changed complete script to use json for compatibility reasons