updated
Fixed some syntax errors and general problems with code before first run.