Fix syntax errors and tweaks