fixed numerous syntax errors, type problems