Major update to multiple files, fixing some syntax errors etc