re-wrote the script to be hosted on google app engine