Bugfixes

Sooo many syntax error fixes.
Added custom error handler
Usually doesn’t crash now
Renamed api.php to index.php, to look better in urls
Various minor changes